function TT = trade(X, E)
% indicator for weather a transaction happens or not
% given value and match value realisation

x = E(5); % average value of house
eps = E(6); % housing homogeneity, -eps

% end-user & developer - 2 cases
% end-user & investor selling - 2 cases
% investor searching & developer - 1 case
% investor searching & investor selling - 1 case

x_b_d_m = (x - eps - X(1) - X(2))/2;
x_b_d_p = (x + eps - X(1) - X(2))/2;
x_b_i_m = (x - eps - X(1) - X(4))/2;
x_b_i_p = (x + eps - X(1) - X(4))/2;
x_i_d = (X(5) - X(2) - X(3))/2;
x_i_i = (X(5) - X(3) - X(4))/2;

idx = zeros(1, 6); 

% is meeting -> contract
if x_b_d_m >= 0
    idx(1) = 1;
end
if x_b_d_p >= 0
    idx(2) = 1;
end
if x_b_i_m >= 0
    idx(3) = 1;
end
if x_b_i_p >= 0
    idx(4) = 1;
end
if x_i_d >= 0
    idx(5) = 1;
end
if x_i_i >= 0
    idx(6) = 1;
end

TT = idx;